<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1.创建xhr对象
        var xhr = new XMLHttpRequest;
        // 2.open方法
        xhr.open('GET', 'http://www.liulongbin.top:3006/api/getbooks');
        // 3.send方法发送请求
        xhr.send();
        // 4.监听数据
        xhr.onreadystatechange = function() {
            if (xhr.readystate === 4 && xhr.status === 200) {
                // console.log(xhr.responseText);

            }
        }
    </script>
</body>

</html>